<script type="text/html" template lay-done="layui.data.done(d);">
    <div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsAgentGrade-createForm" id="LAY-app-CoreCmsAgentGrade-createForm">

        <div class="layui-form-item">
            <label for="name" class="layui-form-label ">等级名称</label>
            <div class="layui-input-block">
                <input name="name" lay-verify="required|verifyname" class="layui-input" lay-reqText="请输入等级名称" placeholder="请输入等级名称" />
            </div>
        </div>

        <div class="layui-form-item" pane>
            <label for="isDefault" class="layui-form-label ">是否默认等级</label>
            <div class="layui-input-block">
                <input type="checkbox" lay-filter="switch" name="isDefault" lay-skin="switch" lay-text="开启|关闭">
            </div>
        </div>

        <div class="layui-form-item" pane>
            <label for="isAutoUpGrade" class="layui-form-label ">是否自动升级</label>
            <div class="layui-input-block">
                <input type="checkbox" lay-filter="switch" name="isAutoUpGrade" lay-skin="switch" lay-text="开启|关闭">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="defaultSalesPriceType" class="layui-form-label ">价格加成方式</label>
            <div class="layui-input-block">
                <select name="defaultSalesPriceType" lay-verify="required" lay-reqText="请选择价格加成方式">
                    <option value="">请选择升级条件</option>
                    {{# layui.each(d.params.data.agentDefaultSalesPriceType, function(index, item){ }}
                    <option value="{{ item.value }}">{{ item.description }}</option>
                    {{# }); }}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="defaultSalesPriceNumber" class="layui-form-label ">价格加成值</label>
            <div class="layui-input-block">
                <input type="number" min="0" max="999999" name="defaultSalesPriceNumber" lay-verify="required|number" class="layui-input" value="1" placeholder="请输入价格加成值" lay-reqText="请输入价格加成值并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sortId" class="layui-form-label ">等级排序</label>
            <div class="layui-input-block">
                <input type="number" min="0" max="999999" name="sortId" lay-verify="required|number" class="layui-input" value="1" placeholder="请输入等级排序" lay-reqText="请输入等级排序并为数字" />
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="description" class="layui-form-label ">等级说明</label>
            <div class="layui-input-block">
                <textarea name="description" lay-verify="required|verifydescription" class="layui-textarea" lay-reqText="请输入等级说明" placeholder="请输入等级说明" />
            </div>
        </div>

        <div class="layui-form-item text-right core-hidden">
            <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsAgentGrade-createForm-submit" id="LAY-app-CoreCmsAgentGrade-createForm-submit" value="确认添加">
        </div>
    </div>
</script>
<script>
    var debug = layui.setter.debug;
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d.params.data); }
        layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
            function () {
                var $ = layui.$
                    , form = layui.form
                    , admin = layui.admin
                    , laydate = layui.laydate
                    , upload = layui.upload
                    , cropperImg = layui.cropperImg
                    , coreHelper = layui.coreHelper;

                form.verify({

                    verifyname: [/^.{0,50}$/, '等级名称最大只允许输入50位字符'],
                    verifydescription: [/^.{0,500}$/, '等级说明最大只允许输入500位字符'],
                });
                //重载form
                form.render(null, 'LAY-app-CoreCmsAgentGrade-createForm');
            })
    };
</script>
